<template>
  <div class="container">
    <div class="header">
      <img src="../../assets/3.png" alt="" class="bg" />
      <van-button round type="success" color="#cecece" @click="$router.go(-1)"
        >X</van-button
      >
    </div>
    <div class="content">
      <div class="ultra3">
        <span class="title">电影标题</span>
        <span class="rating">9.0<span>分</span></span>
      </div>

      <div class="info">类型：动作 / 冒险</div>
      <div class="info">上映时间：2024-03-20</div>
      <div class="info">地区：中国 / 美国</div>
      <div class="info">时长：120分钟</div>
      <div class="description" :class="{ 'description-expanded': !isExpanded }">
        <p>
          电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介电影简介
        </p>
      </div>
      <div class="open_close" @click="toggleDescription">
        <img src="../../assets/6.png" alt="" />
      </div>
      <div class="ultra">
        <div class="word">演职人员</div>
        <div class="actors">
          <div class="actor" v-for="item in 10">
            <img src="../../assets/4.jpg" alt="演员1" />
            <div class="actor-name">演员1</div>
            <div class="actor-role">导演</div>
          </div>
        </div>
      </div>
      <div class="middle"></div>
      <div class="ultra2">
        <div class="word">剧照</div>
        <div class="photos">
          <div class="photo" v-for="item in 10">
            <img src="../../assets/5.jpg" alt="剧照1" />
          </div>
        </div>
      </div>
    </div>
    <button class="button">选座购票</button>
  </div>
</template>

<script lang="ts">
import { ref } from "vue";
export default {
  setup() {
    // const router = useRouter();
    // function back() {
    //   router.push("/");
    // }
    const isExpanded = ref(false);

    const toggleDescription = () => {
      isExpanded.value = !isExpanded.value;
    };
    return {
      // back,
      isExpanded,
      toggleDescription,
    };
  },
};
</script>

<style scoped>
* {
  box-sizing: border-box;
}
/* 后来 */
.open_close {
  width: 100%;
  height: 20px;
}
.open_close img {
  width: 8px;
  height: 4px;
  margin-left: 43.666667vw;
}
.ultra2 {
  padding-top: 15px;
  height: 48.666667vw;
}
.rating span {
  font-size: 13px;
}
.ultra3 {
  margin-bottom: 10px;
}
/* .middle {
  width: 100%;
  height: 10px;
  background-color: rgb(222, 222, 222);
} */
/* done */
.container {
  max-width: 600px;
  margin: 0px auto;
  background-color: #fff;
  overflow: hidden;
}
.bg {
  width: 100%;
  height: 250px;
}
.header {
  position: relative;
}

.van-button {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 20px;
}
.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.content {
  padding: 20px;
}

.title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 10px;
}

.rating {
  color: #ffd700; /* 黄色评分 */
  font-size: 24px;
  margin-left: 180px;
}

.info {
  font-size: 14px;
  color: #666;
  margin-bottom: 5px;
}

.description {
  margin-top: 20px;
  transition: 0.5s ease;
}
.description p {
  line-height: 20px;
  transition: 0.5s ease;
}

.actors {
  margin-top: 20px;
  overflow-x: auto;
  white-space: nowrap;
}

.actor {
  display: inline-block;
  text-align: center;
  margin-right: 10px;
}

.actor img {
  width: 80px;
  height: 100px;
  border-radius: 50%;
}

.actor-name {
  margin-top: 5px;
  font-weight: bold;
}

.actor-role {
  font-size: 12px;
  color: #666;
}

.photos {
  margin-top: 20px;
  overflow-x: auto;
  white-space: nowrap;
}

.photo {
  display: inline-block;
  margin-right: 10px;
}

.photo img {
  width: 150px;
  height: 100px;
  object-fit: cover;
  border-radius: 5px;
}

.button {
  width: 100%;
  padding: 10px 0;
  background-color: #ffa500; /* 橘黄色按钮 */
  color: #fff;
  font-size: 18px;
  text-align: center;
  border: none;
  cursor: pointer;
  position: fixed;
  bottom: 0px;
}
.description-expanded p {
  max-height: 70px;
  overflow: auto;
  transition: 0.5s ease;
}
</style>
